package com.yufei.infoExtractor.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * Created by IntelliJ IDEA.
 * User: MK
 * Date: 2010-9-16
 * Time: 11:07:35
 */
public class ResourceLoader {

    private static final String SAVE_CLASS = "save.class";

    private static ResourceLoader instance;

    private static final Logger log = Logger.getLogger(ResourceLoader.class);

    private Properties pro;

    private ResourceLoader() {
        pro = new Properties();
    }

    public static ResourceLoader getInstance() {
        if (instance == null) {
            instance = new ResourceLoader();
        }
        return instance;
    }

    public void setResourceLocation(String fileName) {
        try {
            InputStream input = ResourceLoader.class.getClassLoader().getResourceAsStream("conf/config.properties");
            pro.load(input);
        } catch (IOException e) {
            log.error(fileName + "配置文件加载出错！", e);
        }
    }

    public String getSaveClass() {
        return pro.getProperty(SAVE_CLASS);
    }


}
